<template>
	<view>
	<!--授权手机号-->
	<uni-popup ref="popup" type="center" class="uni_popup">
		<view class="phoneBox">
			<image class="close" src="/static/image/close1.png" @click="close"><image>
			<view class="intro">验证身份</view>
			<view style="padding: 20rpx 50rpx 0 50rpx;">
				<u-form :model="form" ref="uForm" 	labelWidth="150rpx">
					<u-form-item label="姓名" ><u-input v-model="form.name" /></u-form-item>
					<u-form-item label="手机号" ><u-input v-model="form.mobile" /></u-form-item>	
				</u-form>
				<!--<view class="privacy">
				      <view class="agree">
				        <view @click="isAgree=!isAgree">
				          <uni-icons
				            v-if="isAgree"
				            type="checkbox"
				            color="#357fff"
				            size="20"
				          ></uni-icons>
				          <uni-icons
				            v-else
				            type="circle"
				            color="#999"
				            size="20"
				          ></uni-icons>
				        </view>
				
				        <text>我已阅读并同意</text>
				        <text class="atext" @click="jump('/pages/other/server-detail')">用户服务协议</text>、
				        <text class="atext" @click="jump('/pages/other/privacy-detail')">隐私政策</text>
				      </view>
				 </view>-->
				<button @click="submit" class="btn">验证</button>
			</view>
		</view>

	</uni-popup>
	</view>
</template>

<script>
	import uniPopup from '@/components/uniapp-components/uni-popup/uni-popup.vue';
	export default {
		data(){
			return {
				isAgree: false,
				toLink : '',
				form : {
					name   : '',
					mobile : '',
				}
			}
		},
		components: {
			uniPopup
		},
		props:{
			
		},
		methods: {
			jump(url) {
				uni.navigateTo({
					url
				})
			},
			open(url){
				this.toLink = url
				this.$refs.popup.open()
			},
			close(){
				this.$emit('close')
				this.$refs.popup.close()
			},
			submit(){
				var that = this;
				that.$http.validateUserInfo(that.$data.form).then(res => {
					uni.hideToast();
					if (res.code == 1) {
						that.close()
						that.getUser()
						that.$emit('getMobile')
						if(that.toLink != ''){
							uni.navigateTo({
								url : that.toLink
							})
						}
						
			
					} else {
						uni.showToast({
							title:res.msg,
							icon: "none"
						})
					}
				});
			},
			getUser() {
				this.$http.getUser().then(res => {
					this.userInfo = res.data;
					uni.setStorageSync('mobile',this.userInfo && this.userInfo.mobile?this.userInfo.mobile:'')
				});
			},
			
		},
			

	}
</script>

<style scoped lang="scss">
    
	.phoneBox{
		width: 690rpx;
		height:600rpx;
		background-color: #fff;
		border-radius: 8rpx;
		text-align: center;
		.close{
			width:37rpx;
			height:37rpx;
			float:right;
			margin:36rpx;
		}
		image{
			width:0;
			height:0;
		}
		.intro{
			width:100%;
			text-align: center;
			font-size:30rpx;
			color:#000;
			font-weight: blod;
			margin-top:80rpx;
			
		}
		.img{
			width:186rpx;
			height:160rpx;	
			margin-top:50rpx;
		}
		
	}
	.btn{
		width:390rpx;
		height:68rpx;
		line-height: 68rpx;
		font-size:24rpx;
		color:#fff;
		margin-top:45rpx;
		background-color: #E52F27;
		border-radius: 34rpx;
		&::after{
			border:0;
		}
		
	}
	
// .privacy {
//       display: flex;
//       margin-top: 30rpx;
//       font-size: 24rpx;
//       justify-content: center;
//       color: #999;

//       .agree {
//         display: flex;
//         align-items: center;

//         .uni-icons {
//           margin-right: 10rpx;
//         }
//       }

//       .atext {
//         color: #357fff;
//       }
//     }
</style>
